home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / FindByContent.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  11.2 KB  |  367 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        FindByContent.a
  3. ;
  4. ;    Contains:    Public search interface for the Find by Content shared library
  5. ;
  6. ;    Version:    Technology:    2.0
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__FINDBYCONTENT__') = 'UNDEFINED' THEN
  18. __FINDBYCONTENT__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  24.     include 'Files.a'
  25.     ENDIF
  26.  
  27.  
  28. gestaltFBCIndexingState            EQU        'fbci'                ; Find By Content indexing state
  29. gestaltFBCindexingSafe            EQU        0                    ; any search will result in synchronous wait
  30. gestaltFBCindexingCritical        EQU        1                    ; any search will execute immediately
  31.  
  32. gestaltFBCVersion                EQU        'fbcv'                ; Find By Content version
  33. gestaltFBCCurrentVersion        EQU        $0011                ; First release 
  34.  
  35.  
  36. ;   ***************************************************************************
  37. ;   Phase values
  38. ;   These values are passed to the client's callback function to indicate what
  39. ;   the FBC code is doing.
  40. ;   ***************************************************************************
  41.  
  42.  
  43.  
  44.                                                             ; indexing phases
  45. kFBCphIndexing                    EQU        0
  46. kFBCphFlushing                    EQU        1
  47. kFBCphMerging                    EQU        2
  48. kFBCphMakingIndexAccessor        EQU        3
  49. kFBCphCompacting                EQU        4
  50. kFBCphIndexWaiting                EQU        5                    ; access phases
  51. kFBCphSearching                    EQU        6
  52. kFBCphMakingAccessAccessor        EQU        7
  53. kFBCphAccessWaiting                EQU        8                    ; summarization
  54. kFBCphSummarizing                EQU        9                    ; indexing or access
  55. kFBCphIdle                        EQU        10
  56. kFBCphCanceling                    EQU        11
  57.  
  58. ;   ***************************************************************************
  59. ;   FBC errors are assigned in the range -30500 to -30539, inclusive.
  60. ;   ***************************************************************************
  61.  
  62.  
  63.  
  64.  
  65. kFBCvTwinExceptionErr            EQU        -30500                ;no telling what it was
  66. kFBCnoIndexesFound                EQU        -30501
  67. kFBCallocFailed                    EQU        -30502                ;probably low memory
  68. kFBCbadParam                    EQU        -30503
  69. kFBCfileNotIndexed                EQU        -30504
  70. kFBCbadIndexFile                EQU        -30505                ;bad FSSpec, or bad data in file
  71. kFBCcompactionFailed            EQU        -30506                ;V-Twin exception caught
  72. kFBCvalidationFailed            EQU        -30507                ;V-Twin exception caught
  73. kFBCindexingFailed                EQU        -30508                ;V-Twin exception caught
  74. kFBCcommitFailed                EQU        -30509                ;V-Twin exception caught
  75. kFBCdeletionFailed                EQU        -30510                ;V-Twin exception caught
  76. kFBCmoveFailed                    EQU        -30511                ;V-Twin exception caught
  77. kFBCtokenizationFailed            EQU        -30512                ;couldn't read from document or query
  78. kFBCmergingFailed                EQU        -30513                ;couldn't merge index files
  79. kFBCindexCreationFailed            EQU        -30514                ;couldn't create index
  80. kFBCaccessorStoreFailed            EQU        -30515
  81. kFBCaddDocFailed                EQU        -30516
  82. kFBCflushFailed                    EQU        -30517
  83. kFBCindexNotFound                EQU        -30518
  84. kFBCnoSearchSession                EQU        -30519
  85. kFBCindexingCanceled            EQU        -30520
  86. kFBCaccessCanceled                EQU        -30521
  87. kFBCindexFileDestroyed            EQU        -30522
  88. kFBCindexNotAvailable            EQU        -30523
  89. kFBCsearchFailed                EQU        -30524
  90. kFBCsomeFilesNotIndexed            EQU        -30525
  91. kFBCillegalSessionChange        EQU        -30526                ;tried to add/remove vols to a session
  92.                                                             ;that has hits
  93. kFBCanalysisNotAvailable        EQU        -30527
  94. kFBCbadIndexFileVersion            EQU        -30528
  95. kFBCsummarizationCanceled        EQU        -30529
  96. kFBCindexDiskIOFailed            EQU        -30530
  97. kFBCbadSearchSession            EQU        -30531
  98. kFBCnoSuchHit                    EQU        -30532
  99.  
  100.  
  101. ;   ***************************************************************************
  102. ;   Pointer types
  103. ;   These point to memory allocated by the FBC shared library, and must be deallocated
  104. ;   by calls that are defined below.
  105. ;   ***************************************************************************
  106.  
  107.  
  108.  
  109. ;  A collection of state information for searching
  110.  
  111.  
  112. ;  a FBCWordList is a pointer to an array of pointers to c-strings
  113. FBCWordListRec            RECORD 0
  114. words                     ds.l    1                ; offset: $0 (0) <-- really an array of length one ;  array of pointers to c-strings
  115. sizeof                     EQU *                    ; size:   $4 (4)
  116.                         ENDR
  117. ; typedef struct FBCWordListRec *        FBCWordList
  118.  
  119.  
  120. ;   ***************************************************************************
  121. ;   Callback function type for progress reporting and cancelation during
  122. ;   searching and indexing.  The client's callback function should call
  123. ;   WaitNextEvent; a "sleep" value of 1 is suggested.  If the callback function
  124. ;   wants to cancel the current operation (indexing, search, or doc-terms
  125. ;   retrieval) it should return true.
  126. ;   ***************************************************************************
  127.  
  128.  
  129.  
  130.  
  131. ;   ***************************************************************************
  132. ;   Set the callback function for progress reporting and cancelation during
  133. ;   searching and indexing, and set the amount of heap space to reserved for
  134. ;   the client's use when FBC allocates memory.
  135. ;   ***************************************************************************
  136.  
  137.  
  138. ;
  139. ; extern void FBCSetCallback(FBCCallbackProcPtr fn, void *data)
  140. ;
  141.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  142.         IMPORT_CFM_FUNCTION FBCSetCallback
  143.     ENDIF
  144.  
  145. ;
  146. ; extern void FBCSetHeapReservation(UInt32 bytes)
  147. ;
  148.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  149.         IMPORT_CFM_FUNCTION FBCSetHeapReservation
  150.     ENDIF
  151.  
  152.  
  153. ;   ***************************************************************************
  154. ;   Find out whether a volume is indexed, the date & time of its last
  155. ;   completed  update, and its physical size.
  156. ;   ***************************************************************************
  157.  
  158.  
  159.  
  160. ;
  161. ; extern Boolean FBCVolumeIsIndexed(SInt16 theVRefNum)
  162. ;
  163.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  164.         IMPORT_CFM_FUNCTION FBCVolumeIsIndexed
  165.     ENDIF
  166.  
  167. ;
  168. ; extern Boolean FBCVolumeIsRemote(SInt16 theVRefNum)
  169. ;
  170.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  171.         IMPORT_CFM_FUNCTION FBCVolumeIsRemote
  172.     ENDIF
  173.  
  174. ;
  175. ; extern OSErr FBCVolumeIndexTimeStamp(SInt16 theVRefNum, UInt32 *timeStamp)
  176. ;
  177.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  178.         IMPORT_CFM_FUNCTION FBCVolumeIndexTimeStamp
  179.     ENDIF
  180.  
  181. ;
  182. ; extern OSErr FBCVolumeIndexPhysicalSize(SInt16 theVRefNum, UInt32 *size)
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION FBCVolumeIndexPhysicalSize
  186.     ENDIF
  187.  
  188.  
  189. ;   ***************************************************************************
  190. ;   Create & configure a search session
  191. ;   ***************************************************************************
  192.  
  193.  
  194.  
  195. ;
  196. ; extern OSErr FBCCreateSearchSession(FBCSearchSession *searchSession)
  197. ;
  198.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  199.         IMPORT_CFM_FUNCTION FBCCreateSearchSession
  200.     ENDIF
  201.  
  202. ;
  203. ; extern OSErr FBCAddAllVolumesToSession(FBCSearchSession theSession, Boolean includeRemote)
  204. ;
  205.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  206.         IMPORT_CFM_FUNCTION FBCAddAllVolumesToSession
  207.     ENDIF
  208.  
  209. ;
  210. ; extern OSErr FBCSetSessionVolumes(FBCSearchSession theSession, const SInt16 vRefNums[2147483647], UInt16 numVolumes)
  211. ;
  212.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  213.         IMPORT_CFM_FUNCTION FBCSetSessionVolumes
  214.     ENDIF
  215.  
  216. ;
  217. ; extern OSErr FBCAddVolumeToSession(FBCSearchSession theSession, SInt16 vRefNum)
  218. ;
  219.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  220.         IMPORT_CFM_FUNCTION FBCAddVolumeToSession
  221.     ENDIF
  222.  
  223. ;
  224. ; extern OSErr FBCRemoveVolumeFromSession(FBCSearchSession theSession, SInt16 vRefNum)
  225. ;
  226.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  227.         IMPORT_CFM_FUNCTION FBCRemoveVolumeFromSession
  228.     ENDIF
  229.  
  230. ;
  231. ; extern OSErr FBCGetSessionVolumeCount(FBCSearchSession theSession, UInt16 *count)
  232. ;
  233.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  234.         IMPORT_CFM_FUNCTION FBCGetSessionVolumeCount
  235.     ENDIF
  236.  
  237. ;
  238. ; extern OSErr FBCGetSessionVolumes(FBCSearchSession theSession, SInt16 vRefNums[2147483647], UInt16 *numVolumes)
  239. ;
  240.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  241.         IMPORT_CFM_FUNCTION FBCGetSessionVolumes
  242.     ENDIF
  243.  
  244. ;
  245. ; extern OSErr FBCCloneSearchSession(FBCSearchSession original, FBCSearchSession *clone)
  246. ;
  247.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  248.         IMPORT_CFM_FUNCTION FBCCloneSearchSession
  249.     ENDIF
  250.  
  251.  
  252. ;   ***************************************************************************
  253. ;   Execute a search
  254. ;   ***************************************************************************
  255.  
  256.  
  257.  
  258. ;
  259. ; extern OSErr FBCDoQuerySearch(FBCSearchSession theSession, char *queryText, const FSSpec targetDirs[2147483647], UInt32 numTargets, UInt32 maxHits, UInt32 maxHitWords)
  260. ;
  261.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  262.         IMPORT_CFM_FUNCTION FBCDoQuerySearch
  263.     ENDIF
  264.  
  265. ;
  266. ; extern OSErr FBCDoExampleSearch(FBCSearchSession theSession, const UInt32 *exampleHitNums, UInt32 numExamples, const FSSpec targetDirs[2147483647], UInt32 numTargets, UInt32 maxHits, UInt32 maxHitWords)
  267. ;
  268.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  269.         IMPORT_CFM_FUNCTION FBCDoExampleSearch
  270.     ENDIF
  271.  
  272. ;
  273. ; extern OSErr FBCBlindExampleSearch(FSSpec examples[2147483647], UInt32 numExamples, const FSSpec targetDirs[2147483647], UInt32 numTargets, UInt32 maxHits, UInt32 maxHitWords, Boolean allIndexes, Boolean includeRemote, FBCSearchSession *theSession)
  274. ;
  275.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  276.         IMPORT_CFM_FUNCTION FBCBlindExampleSearch
  277.     ENDIF
  278.  
  279.  
  280.  
  281. ;   ***************************************************************************
  282. ;   Get information about hits [wrapper for THitItem C++ API]
  283. ;   ***************************************************************************
  284.  
  285.  
  286.  
  287. ;
  288. ; extern OSErr FBCGetHitCount(FBCSearchSession theSession, UInt32 *count)
  289. ;
  290.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  291.         IMPORT_CFM_FUNCTION FBCGetHitCount
  292.     ENDIF
  293.  
  294. ;
  295. ; extern OSErr FBCGetHitDocument(FBCSearchSession theSession, UInt32 hitNumber, FSSpec *theDocument)
  296. ;
  297.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  298.         IMPORT_CFM_FUNCTION FBCGetHitDocument
  299.     ENDIF
  300.  
  301. ;
  302. ; extern OSErr FBCGetHitScore(FBCSearchSession theSession, UInt32 hitNumber, float *score)
  303. ;
  304.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  305.         IMPORT_CFM_FUNCTION FBCGetHitScore
  306.     ENDIF
  307.  
  308. ;
  309. ; extern OSErr FBCGetMatchedWords(FBCSearchSession theSession, UInt32 hitNumber, UInt32 *wordCount, FBCWordList *list)
  310. ;
  311.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  312.         IMPORT_CFM_FUNCTION FBCGetMatchedWords
  313.     ENDIF
  314.  
  315. ;
  316. ; extern OSErr FBCGetTopicWords(FBCSearchSession theSession, UInt32 hitNumber, UInt32 *wordCount, FBCWordList *list)
  317. ;
  318.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  319.         IMPORT_CFM_FUNCTION FBCGetTopicWords
  320.     ENDIF
  321.  
  322.  
  323.  
  324. ;   ***************************************************************************
  325. ;   Summarize a buffer of text
  326. ;   ***************************************************************************
  327.  
  328.  
  329.  
  330. ;
  331. ; extern OSErr FBCSummarize(void *inBuf, UInt32 inLength, void *outBuf, UInt32 *outLength, UInt32 *numSentences)
  332. ;
  333.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  334.         IMPORT_CFM_FUNCTION FBCSummarize
  335.     ENDIF
  336.  
  337.  
  338. ;   ***************************************************************************
  339. ;   Deallocate hit lists, word arrays, and search sessions
  340. ;   ***************************************************************************
  341.  
  342.  
  343.  
  344. ;
  345. ; extern OSErr FBCReleaseSessionHits(FBCSearchSession theSession)
  346. ;
  347.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  348.         IMPORT_CFM_FUNCTION FBCReleaseSessionHits
  349.     ENDIF
  350.  
  351. ;
  352. ; extern OSErr FBCDestroyWordList(FBCWordList theList, UInt32 wordCount)
  353. ;
  354.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  355.         IMPORT_CFM_FUNCTION FBCDestroyWordList
  356.     ENDIF
  357.  
  358. ;
  359. ; extern OSErr FBCDestroySearchSession(FBCSearchSession theSession)
  360. ;
  361.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  362.         IMPORT_CFM_FUNCTION FBCDestroySearchSession
  363.     ENDIF
  364.  
  365.     ENDIF ; __FINDBYCONTENT__ 
  366.  
  367.